# -*- coding: utf-8 -*-
from venv1.Public.dbClection import dbClection
import xlrd
from xlutils.copy import copy
from venv1.Public.xlsx_utils import XlsxUtils
class test():
    def test(self):

        db = dbClection()
        xzjd_org = db.getOrgid()
        print(len(xzjd_org))
        print(xzjd_org)
        row = 2

        # 保单号
        # print(len(xzjd_org))
        # print(xzjd_org)
        for i in range(0,len(xzjd_org)):
            a=xzjd_org[i]

            try:
                b=a[0]
                print('b的值是',b)
                print('======================================================================================================================================')
            except Exception as msg:
                print('error!')


        # # 电子合同
        # b=xzjd_org[1]
        # # 是否生效
        # c=xzjd_org[2]
            policyno = b['REFNO']
            econtract=b['LETTYPE']
            effective=b['STATCODE']
            CHDRNUM=b['CHDRNUM']
            BILLFREQ=b['BILLFREQ']



            if effective=='IF':
                effective1='生效'
            elif effective=='DC':
                effective1='拒保'
            else:
                effective1 = '其他'

            if econtract=='ZLPOLPAC':
                econtract1='有'
            else:
                econtract1 = '无'


            filename = r'..\TestData\outputdata.xlsx'
            xlutil = XlsxUtils()

            xlutil.set_sheet_value(filename=filename, sheetname='Sheet1', row=row, col=1, value=policyno)
            xlutil.set_sheet_value(filename=filename, sheetname='Sheet1', row=row, col=2, value=CHDRNUM)
            xlutil.set_sheet_value(filename=filename, sheetname='Sheet1', row=row, col=3, value=effective)
            xlutil.set_sheet_value(filename=filename, sheetname='Sheet1', row=row, col=4, value=econtract1)
            xlutil.set_sheet_value(filename=filename, sheetname='Sheet1', row=row, col=5, value=BILLFREQ)
            row=row+1
# test().test()














